﻿<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="json">
		<meta name="keywords" content="Android开发">
		<link rel="shortcut icon" href="/img/favicon.ico">

		<title>AGAGA</title>

		<link rel="canonical" href="http://localhost:4000/io/tools/json-to-dart/">

		<link href="https://cdn.staticfile.org/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">

		<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
		<script></script>
	</head>

	<!--line  33420-->

	<body ontouchstart="">

		<script>
			// Drop Bootstarp low-performance Navbar
			// Use customize navbar with high-quality material design animation
			// in high-perf jank-free CSS3 implementation
			var $body = document.body;
			var $navbar = document.querySelector('#huxblog_navbar');
			var $collapse = document.querySelector('.navbar-collapse');
			var __HuxNav__ = {
					close: function() {
						$navbar.className = " ";
						// wait until animation end.
						setTimeout(function() {
							// prevent frequently toggle
							if ($navbar.className.indexOf('in') < 0) {
								$collapse.style.height = "0px"
							}
						}, 400)
					},
					open: function() {
						$collapse.style.height = "auto"
						$navbar.className += " in";
					}
				}
			document.addEventListener('click', function(e) {
				if (e.target.className == 'icon-bar') return;
				__HuxNav__.close();
			})
		</script>

		<style type="text/css">
			header.intro-header {
				position: relative;
				background-image: url('/img/home-bg.jpg')
			}
			
			@media (min-width: 1600px) {
				header.intro-header {
					position: relative;
					background-image: url('/img/home-bg.jpg')
				}
			}
		</style>
		<!-- Page Header -->
		<header class="intro-header">
			<div class="container">
				<div class="row">
					<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 ">
						<div class="site-heading">
							<span style="font-size: xx-large;text-transform:none">JSON 转Dart</span>
							<!--<hr class="small">-->
							<span class="subheading">JSON 转Dart</span>
						</div>
					</div>
				</div>
			</div>
		</header>

		<!-- Main Content -->
		<div class="container">
			<div class="row">

				<!-- USE SIDEBAR -->
				<!-- PostList Container -->
				<div class="
                col-lg-8 col-lg-offset-1
                col-md-8 col-md-offset-1
                col-sm-12
                col-xs-12
                postlist-container
            ">
					<link rel="stylesheet" href="res/github.css">

					<div>
						<form onsubmit="return false;">
							<div class="form-group">
								<label for="json">JSON</label>
								<textarea class="form-control" id="json" rows="3"></textarea>
							</div>
							<button type="submit" class="btn btn-primary" style="padding:16px;border-radius: 10px;background-color: dodgerblue;border-width: 0">生成</button>
							<label><input type="checkbox" id="private-fields"> 使用私有字段</label>
							<button id="copy-clipboard" class="btn btn-primary" style="padding:10px;border-radius: 10px;border-width:0;background-color: orangered">复制到剪切板</button>
						</form>
					</div>
					<div style="margin-top: 36px">
						<b id="invalid-dart" style="display: none">生成的Dart代码无效</b>
						<pre style="min-height: 60px"><code class="dart hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Autogenerated</span> </span>{
  <span class="hljs-built_in">int</span> a;

  Autogenerated({<span class="hljs-keyword">this</span>.a});

  Autogenerated.fromJson(<span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-keyword">dynamic</span>&gt; json) {
    a = json[<span class="hljs-string">'a'</span>];
  }

  <span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-keyword">dynamic</span>&gt; toJson() {
    <span class="hljs-keyword">final</span> <span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-keyword">dynamic</span>&gt; data = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-keyword">dynamic</span>&gt;();
    data[<span class="hljs-string">'a'</span>] = <span class="hljs-keyword">this</span>.a;
    <span class="hljs-keyword">return</span> data;
  }
}
</code>
    </pre>
						<textarea style="position:fixed;opacity: 0;" id="hidden-dart"></textarea>
					</div>

					<script src="res/highlight.min.js"></script>
					<script src="res/page.js"></script>

				</div>
			</div>

			<!-- jQuery -->
			<script src="/js/jquery.min.js "></script>

			<!-- Bootstrap Core JavaScript -->
			<script src="/js/bootstrap.min.js "></script>

			<!-- Custom Theme JavaScript -->
			<script src="/js/hux-blog.min.js "></script>

			<!-- async load function -->
			<script>
				function async(u, c) {
					var d = document,
						t = 'script',
						o = d.createElement(t),
						s = d.getElementsByTagName(t)[0];
					o.src = u;
					if (c) {
						o.addEventListener('load', function(e) {
							c(null, e);
						}, false);
					}
					s.parentNode.insertBefore(o, s);
				}
			</script>

			<!--fastClick.js -->
			<script>
				async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function() {
					var $nav = document.querySelector("nav");
					if ($nav) FastClick.attach($nav);
				})
			</script>

	</body>

</html>